package com.google.random;

import java.util.Random;
import java.util.Scanner;

;

/**
 * @author Mucd
 * @Date 2020/12/7/007
 * @ClassName Test
 */
public class Test {
    public static void main(String[] args) {

        while(true){
            Scanner sc = new Scanner(System.in);
            Random random = new Random();
            int randomInt = random.nextInt(101);
            System.out.print("输入1-100的整数");
            int scInt = sc.nextInt();
            if (scInt >randomInt){
                System.out.println("正确的数:"+randomInt);
                System.out.println("数大了");
            }else if (scInt < randomInt){
                System.out.println("正确的数:"+randomInt);
                System.out.println("数小了");
            }else {
                System.out.println("正确的数:"+randomInt);
                System.out.println("猜对了");
                //猜对了就结束,猜不对就继续循环
                break;
            }
        }
    }
}
